﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;

namespace VLXD.uc
{
    public partial class ThongTinNguoiDung : System.Web.UI.UserControl
    {
        public NguoiDung_Info us;
        public int ID;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["admin"] != null)
            {
                ID = int.Parse(Session["admin"].ToString());
                us = NguoiDung_Info.NguoiDung_Chon(ID);
                txtTenNguoiDung.Text = us.TenDangNhap;
                txthoten.Text = us.TenDayDu;
                txtsdt.Text = us.SoDienThoai;
                txtEmail.Text = us.Email;
                txtdiachi.Text = us.DiaChi;
            }
            else
            {
                Response.Redirect("default.aspx");
            }
        }

        protected void bntCapNhat_Click(object sender, EventArgs e)
        {
            us.TenDangNhap = txtTenNguoiDung.Text;
            us.TenDayDu = txthoten.Text;
            us.SoDienThoai = txtsdt.Text;
            us.Email = txtEmail.Text;
            us.DiaChi = txtdiachi.Text;
            if ( NguoiDung_Info.NguoiDung_CapNhat(us))
            {
                 Label1.Text = "Cập nhật thành công !";
            }
            else
            {
                Label1.Text = "Cập nhật không thành công !";
            }
           
        }

        protected void bntDoiMatKhau_Click(object sender, EventArgs e)
        {
            Response.Redirect("default.aspx?page=DoiMatKhau");
          
        }


    }
}